批量创建 Coupon 对象

通过 coupon_template 对象的 id 批量在多个用户下各生成一张优惠券。一般由服务端主动触发(批量发放)。

请求参数描述
APP_ID required string对应 app 对象的 id,该参数仅需要填写在请求地址内,查看 如何获取App ID
COUPON_TMPL_ID required stringcoupon_template 对象的 id,该参数仅需要填写在请求地址内。
users required listuser 对象的 id 列表。
metadata optional hash详见 元数据

返回

返回一个 coupon 对象列表,或者返回一个错误,详见 错误

定义

POST https://api.pingxx.com/v1/apps/{APP_ID}/coupon_templates/{COUPON_TMPL_ID}/coupons
待补充
待补充
待补充
待补充
待补充
待补充
待补充

请求示例

POST https://api.pingxx.com/v1/apps/{APP_ID}/coupon_templates/{COUPON_TMPL_ID}/coupons \
-H "Pingplusplus-Request-Timestamp: 1475029155" \
-H "Pingplusplus-Signature: SIGNATURE" \
-u sk_test_ibbTe5jLGCi5rzfH4OqPW9KC:
-d '{
    "users": [
        "user_id_1",
        "user_id_2",
        "user_id_3"
    ]
}'
待补充
待补充
待补充
待补充
待补充
待补充
待补充

返回示例

{
  "object": "list",
  "url": "/v1/apps/APP_ID/coupon_templates/COUPON_TMPL_ID/coupons",
  "has_more": false,
  "data": [
    {
      "id": "300418080916580200113202",
      "object": "coupon",
      "app": "APP_ID",
      "actual_amount": 0,
      "coupon_template": {
        "id": "300218051415370500016201",
        "object": "coupon_template",
        "app": "APP_ID",
        "amount_available": 0,
        "amount_off": null,
        "created": 1526283425,
        "expiration": {
          "time_start": null,
          "time_end": null,
          "duration": null
        },
        "livemode": true,
        "max_circulation": null,
        "max_user_circulation": 100,
        "metadata": {
          "custom_key": "custom_value"
        },
        "name": "9 折券 - 最高减 10 元",
        "percent_off": 10,
        "times_circulated": 4,
        "times_redeemed": 0,
        "type": 2,
        "refundable": true
      },
      "created": 1533805082,
      "livemode": true,
      "metadata": {},
      "order": null,
      "redeemed": false,
      "time_end": null,
      "time_start": null,
      "user": "user_id_1",
      "valid": true,
      "user_times_circulated": 0
    },
    {
      "id": "300418080916580200113302",
      "object": "coupon",
      "app": "APP_ID",
      "actual_amount": 0,
      "coupon_template": {
        "id": "300218051415370500016201",
        "object": "coupon_template",
        "app": "APP_ID",
        "amount_available": 0,
        "amount_off": null,
        "created": 1526283425,
        "expiration": {
          "time_start": null,
          "time_end": null,
          "duration": null
        },
        "livemode": true,
        "max_circulation": null,
        "max_user_circulation": 100,
        "metadata": {
          "custom_key": "custom_value"
        },
        "name": "9 折券 - 最高减 10 元",
        "percent_off": 10,
        "times_circulated": 4,
        "times_redeemed": 0,
        "type": 2,
        "refundable": true
      },
      "created": 1533805082,
      "livemode": true,
      "metadata": {},
      "order": null,
      "redeemed": false,
      "time_end": null,
      "time_start": null,
      "user": "user_id_2",
      "valid": true,
      "user_times_circulated": 0
    }
  ]
}